﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="WebApp.Controls.test2" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>无标题页</title>

    <script type="text/javascript"> 
function sessionTimeout() 
{ 
var label=document.getElementById("lblTime"); 
var seconds=parseInt(label.value); 
seconds=seconds-1; 
label.value=seconds.toString(); 
    if(seconds==0) 
    { 
    alert("您已超时"); 
    window.location.href="login.aspx";//转到登陆页 
    clearInterval(sessionTimeout); 
    } 
} 
window.setInterval(sessionTimeout,1000); 
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
        剩余秒数：
        <input id="lblTime" name="lblTime" runat="server" type="text" style="border: 0px;
            width: 20px;" />
        <asp:Button ID="Button1" runat="server" Text="操作" /></div>
    </form>
</body>
</html>
